package com.zoffy.oj_backend.model.vo;

import com.zoffy.oj_backend.model.entity.User;
import lombok.Data;


@Data
public class UserVo {

    private Long id;

    /**
     * 账号
     */
    private String userAccount;

    /**
     * 用户昵称
     */
    private String userName;

    /**
     * 用户头像
     */
    private String userAvatar;

    /**
     * 用户简介
     */
    private String userProfile;

    /**
     * 用户角色: user/admin
     */
    private String userRole;

    public static UserVo obj2Vo(User user){
        UserVo userVo=new UserVo();
        userVo.setId(user.getId());
        userVo.setUserAccount(user.getUserAccount());
        userVo.setUserName(user.getUserName());
        userVo.setUserAvatar(user.getUserAvatar());
        userVo.setUserProfile(user.getUserProfile());
        userVo.setUserRole(user.getUserRole());
        return userVo;
    }
}
